package top.leyi.handle;

import org.springframework.boot.web.servlet.error.ErrorController;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import top.leyi.utils.Result;
import top.leyi.utils.ResultGenerator;

@Controller
@RequestMapping("${server.error.path:${error.path:/error}}")
public class ErrorHandle implements ErrorController {
    @Override
    public String getErrorPath() {
        return "/error";
    }

    @RequestMapping
    @ResponseBody
    public Result doHandleError(){
        return  ResultGenerator.ERROR_URL.getResult();
    }
}
